home *** CD-ROM | disk | FTP | other *** search
/ Compton's Encyclopedia of American History / Compton's Encyclopedia of American History.iso / install / history.mst < prev    next >
Text File  |  1995-02-06  |  33KB  |  1,108 lines

  1. '*******************************************************************
  2. '*
  3. '*    DESCRIPTION: Compton's American History Installation Script
  4. '*
  5. '*
  6. '*******************************************************************
  7. '**************************************************************************
  8. '*   Compton's American History AND Database files AND Video For Windows 1.1 
  9. '**************************************************************************
  10. '$DEFINE DEBUG  ''Define for script development/debugging
  11. '$INCLUDE 'setupapi.inc'
  12. '$INCLUDE 'msdetect.inc'
  13.  
  14.  
  15. ''Dialog ID's
  16. CONST WELCOME       =  100
  17. CONST ASKQUIT       =  200
  18. CONST ASKQUITNOTHING=  201
  19. CONST ASKQUITNOPROD =  202
  20. CONST ASKEXISTSDIR  =  210
  21. CONST ASKEXISTSPROD =  220
  22. CONST ASKEXISTSWIN  =  230
  23. CONST DESTPATH      =  300
  24. CONST EXITFAILURE   =  400
  25. CONST EXITQUIT      =  600
  26. CONST EXITSUCCESSPROD   =  700
  27. CONST EXITSUCCESSVFW=  701
  28. CONST EXITSUCCESSNMS=  702
  29. CONST PRODHELP      =  900
  30. CONST SIGNBOARD1    = 2001
  31. CONST SIGNBOARD2    = 2002
  32. CONST SIGNBOARD3    = 2003
  33. CONST SIGNBOARD4    = 2004
  34. CONST SIGNBOARD5    = 2005
  35. CONST SIGNBOARD6    = 2006
  36. CONST CUSTINST      = 6200
  37. CONST TOOBIG        = 6300
  38. CONST BADPATH       = 6400
  39. CONST MINREQUIRED   = 6500
  40. CONST RESTART       = 7900
  41. CONST RESTARTII     = 8000
  42.  
  43.  
  44.  
  45. ''Bitmap IDs
  46. CONST IDC_BM0       = 600
  47. CONST IDC_BM1       = 601
  48. ''Icon IDs
  49. CONST IDC_ICON6                 =       506
  50. CONST IDC_ICON7                 =       507
  51.  
  52.  
  53. ''File Types
  54. CONST PROD    = 1
  55. CONST VID     = 2
  56. CONST NMS     = 3
  57.  
  58. '' actual amount plus 10%
  59. CONST PRODCOST = 9085117        
  60. CONST VIDCOST  = 2329118
  61. CONST NMSCOST  = 10304102
  62.  
  63. CONST DISPLAYPATHLEN = 40 '' Length limit for display of path in Custom Installation
  64.  
  65. GLOBAL CUIDLL$
  66.  
  67. GLOBAL szSaveProdDir$
  68. GLOBAL SrcDir$
  69.  
  70. GLOBAL WinDir$
  71. GLOBAL WinSysDir$
  72.  
  73. GLOBAL DEST$        '' Default destination directory.
  74. GLOBAL WINDRIVE$    '' Windows drive letter.
  75.  
  76. GLOBAL szFound$                 '' found filespec
  77.  
  78. ''CustInst list symbol names
  79. GLOBAL PRODFILES$
  80. GLOBAL VIDFILES$
  81. GLOBAL NMSFILES$
  82.  
  83. '' already installed booleans
  84. GLOBAL bProdInstalled%
  85. GLOBAL bVfwInstalled%
  86. GLOBAL bNmsInstalled%
  87.  
  88. GLOBAL cost&
  89. GLOBAL cost1&
  90. GLOBAL free&
  91. GLOBAL free1&
  92.  
  93. GLOBAL CursorSave%
  94.  
  95. ''Dialog list symbol names
  96. GLOBAL CHECKSTATES$
  97. GLOBAL STATUSTEXT$
  98. GLOBAL DRIVETEXT$
  99. GLOBAL REQUIREDTEXT$
  100. GLOBAL HDLIST$
  101. GLOBAL INSTALLTEXT$
  102.  
  103. '' defined functions
  104. DECLARE SUB AddOptFilesToCopyList (ftype%)
  105. DECLARE SUB RecalcOptFiles (ftype%)
  106. DECLARE SUB RecalcPath
  107. DECLARE SUB SetDriveStatus
  108. DECLARE FUNCTION MakePath(szDir$, szFile$) AS STRING
  109. DECLARE SUB CheckForPROD(szPRODDir$)
  110. Declare Function TruncateToLengthOrLess(szSrcStr$, nLength%) As String
  111. Declare Function GetProcessor() As Integer
  112. Declare Function MeetsMinRequired() As Integer
  113. Declare Function RemoveSlash (szDir$) As String
  114. Declare Function MakeDirPath (szDir$) As String
  115. Declare Function CheckForDateVersion(szFile$, szDate$, szVersion$) As String
  116. Declare Sub ModifyIniVFW 
  117. Declare Sub ModifyIniAnimation
  118. Declare Sub InstallProdGroup
  119.  
  120. '' external procedures
  121. Declare Function MaximizeWindow LIB "dlgprocs.dll" (hwnd%) As Integer
  122. Declare Function DoMemManInfo LIB "dlgprocs.dll" (item%) As Integer
  123. Declare Function SetTo256Min LIB "dlgprocs.dll" () As Integer
  124. Declare Function GetVerInfo LIB "dlgprocs.dll" (szPath$, szVer$, Product%) As Integer
  125. Declare Function DoVFWIniFiles LIB "dlgprocs.dll" () As Integer
  126.  
  127.  
  128. DECLARE FUNCTION GetModuleHandle LIB "kernel" (szModName$) AS INTEGER
  129. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  130. DECLARE FUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER
  131. ''Declare Function sndPlaySound Lib "MMSystem" (lpsound As Any, flag As Integer) As Integer
  132. Declare Function waveOutGetNumDevs Lib "MMSystem" () As Integer
  133. ''Declare Function GetDC Lib "User" (hWnd%) As Integer
  134. ''Declare Function GetDeskTopWindow Lib "User" () As Integer
  135. ''Declare Function GetDeviceCaps Lib "GDI" (hDC%, nIndex%) As Integer
  136. DECLARE FUNCTION GetPrivateProfileString LIB "Kernel" (lpApplicationName As String, lpKeyName As String, lpDefault As String, lpReturnedString As String, nSize As Integer, lpFileName As String) As Integer
  137. Declare Function GlobalCompact Lib "kernel" (flag&) As Long
  138. Declare Function GetFreeSpace Lib "kernel" (flag%) As Long
  139. Declare Function GetFreeSystemResources Lib "User" (fuSysResource As Integer) As Integer
  140. ''Declare Function ReleaseDC Lib "User" (hWnd As Integer, hDC As Integer) As Integer
  141.  
  142. Const SM_MOUSEPRESENT = 19
  143.  
  144.  
  145. INIT:
  146.     szSaveProdDir$      = ""
  147.  
  148.   ''Disk cost list symbols
  149.   PRODFILES$   = "Product"
  150.   VIDFILES$    = "VfW Runtime"
  151.   NMSFILES$    = "NMS Files"
  152.  
  153.   CUIDLL$ = "dlgprocs.dll"            '' custom user interface dll
  154.   HELPPROC$ = "FHelpDlgProc"          '' Help dialog procedure
  155.  
  156.   hwnd% = HwndFrame()
  157.   i% = MaximizeWindow(hwnd%)              '' maximize the main window
  158.  
  159.   SetBitmap CUIDLL$, IDC_BM0 '' comptons logo
  160.   SetTitle "Compton's Encyclopedia of American History"
  161.  
  162.   szTmp$ = GetSymbolValue("STF_SRCINFPATH")
  163.   szInf$ = GetSymbolValue("STF_SRCINFPATH")
  164.   IF szInf$ = "" THEN
  165.     szInf$ = GetSymbolValue("STF_CWDDIR") + "HISTORY" + ".INF"
  166.   END IF                                    
  167.   ReadInfFile szInf$
  168.  
  169.   SrcDir$ = GetSymbolValue("STF_SRCDIR")
  170.  
  171.   WinDir$     = GetWindowsDir()
  172.   WinSysDir$  = GetWindowsSysDir()
  173.  
  174.   '' set same drive windows is on as default
  175.   WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  176.   DEST$ = WINDRIVE$ + ":\" + "HISTORY"
  177.  
  178.   '' see if HISTORY is running
  179.   IF GetModuleHandle("CIE95") > 0 THEN
  180.     i% = DoMsgBox("Compton's is currently running."+chr$(13)+"Please exit the program and rerun Setup.","Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  181.         END
  182.   END IF
  183.  
  184.   ''CustInst list symbols
  185.   CHECKSTATES$ = "CheckItemsState"
  186.   STATUSTEXT$  = "StatusItemsText"
  187.   DRIVETEXT$   = "DriveStatusText"
  188.     REQUIREDTEXT$ = "MinRequiredText"
  189.     HDLIST$       = "HdList"
  190.     INSTALLTEXT$  = "InstallItemsText"
  191.  
  192.   '' for each section of inf file
  193.   FOR i% = 1 TO 3 STEP 1
  194.     AddListItem STATUSTEXT$, ""
  195.     AddListItem CHECKSTATES$, "ON"
  196.         AddListItem INSTALLTEXT$, "(Required)"
  197.   NEXT i%
  198.     ReplaceListItem INSTALLTEXT$, 3, "(Speed Enhancement)"
  199.     
  200.   '' for the display in custinst
  201.   FOR i% = 1 TO 7 STEP 1
  202.     AddListItem DRIVETEXT$, ""
  203.     AddListItem REQUIREDTEXT$, ""
  204.   NEXT i%
  205.  
  206.  
  207.     bProdInstalled% = 0
  208.     bVfwInstalled% = 0
  209.     bNmsInstalled% = 0
  210.     
  211.   '' means the message box will allow error to be ignored if file size does not match with inf file
  212.   i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  213.  
  214.  
  215. WELCOME:
  216.   sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", PRODHELP, HELPPROC$)
  217.   IF sz$ = "CONTINUE" THEN
  218.     UIPop 1
  219.   ELSE
  220.     GOSUB ASKQUIT
  221.     GOTO WELCOME
  222.   END IF
  223.  
  224.     i% = MeetsMinRequired()
  225.     If i% = 0 Then
  226.  
  227. MINREQUIRED:
  228.   sz$ = UIStartDlg(CUIDLL$, MINREQUIRED, "FMinReqDlgProc", PRODHELP, HELPPROC$)
  229.   IF sz$ = "CONTINUE" THEN
  230.     UIPop 1
  231.   ELSE
  232.     GOSUB ASKQUIT
  233.     GOTO MINREQUIRED
  234.   END IF
  235.     End If
  236.  
  237.   '' see if the product has been installed before
  238.   szDir$ = GetIniKeyString("WIN.INI", "HISTORY", "PATH")
  239.   IF szDir$ <> "" THEN
  240.     DEST$ = MID$(szDir$,1,LEN(szDir$)-1)
  241.     CheckForPROD(szDir$)
  242.   ELSE
  243.     '' no entry in win.ini should we look for other versions
  244.     '' I say no!
  245.   END IF
  246.  
  247.     '' check for correct version of Video for Windows
  248.   CursorSave% = ShowWaitCursor()
  249.     szVFW$ = CheckForDateVersion("MSVIDEO.DLL", "1994-07-01", "1.10.0.187")
  250.     Select Case szVFW$
  251.         Case "NOT FOUND"
  252.           '' set windows drive and windows directory as default for VFW
  253.         szVFW$ = RemoveSlash(WinDir$)
  254.         Case "INCORRECT"
  255.             szVFW$ = MakeDirPath(szFound$)
  256.         Case Else
  257.         ReplaceListItem CHECKSTATES$, 2, ""
  258.         ReplaceListItem INSTALLTEXT$, 2, "(Already Installed)"
  259.             bVfwInstalled% = 1
  260.     End Select
  261.  
  262.  
  263. CUSTINST:
  264.   '' destination path
  265.   ''Truncate display if too long.
  266.   IF LEN(DEST$) > DISPLAYPATHLEN THEN
  267.         ReplaceListItem DRIVETEXT$, 7, TruncateToLengthOrLess(DEST$, DISPLAYPATHLEN)
  268.   ELSE
  269.         ReplaceListItem DRIVETEXT$, 7, DEST$
  270.   END IF
  271.   RecalcPath
  272.   SetDri